feat: mute system audio while recording - #212
Conversation
17c7dc6 to
2790518
Compare
jatinkrmalik
left a comment
There was a problem hiding this comment.
@Mr-Sunglasses this can leave the Mac muted. I wouldn't ship it as written.
Production AppState is a static singleton, so SystemAudioMuteManager.deinit will not run on Quit. The menu bar and Settings quit with NSApplication.shared.terminate(nil) without restoring output. Force-quit and crashes skip Swift deinit entirely. The snapshot is RAM-only, so the next launch cannot repair a leftover mute.
restoreSystemAudio() also sets muteSnapshot = nil before setMute. If Core Audio fails (Bluetooth gone, sleep, recycled AudioDeviceID), you log a warning and throw away the only record that VocaMac muted the machine.
handleAutoPauseEntered() stops the engine and returns to idle without restore. Mute runs after startAudioEngine(), so on AirPods the HFP settle window (up to 3s) leaks system audio into the mic, then the start chime plays while muted.
Please persist {device UID, wasMuted} before muting, restore on willTerminate and on next launch, keep the snapshot until setMute succeeds, restore in the auto-pause path, and mute before starting the engine.
Also drop closes #167. That issue is Spotify Connect on an external speaker. Muting the Mac default output does not touch it.
Tests currently only assert call counts on MockSystemAudioMuter. The real snapshot/restore machine has zero tests.
closes: #167
Summary
Validation